package org.mf.dao.impl;

import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import javax.persistence.EntityManager;
import javax.persistence.NoResultException;
import javax.persistence.PersistenceContext;

import org.mf.dao.UserDAO;
import org.mf.domain.User;
import org.mf.web.pagination.PagedResultSet;
import org.mf.web.pagination.Pager;
import org.skyway.spring.util.dao.AbstractJpaDao;
import org.springframework.dao.DataAccessException;

public class UserDaoImpl extends AbstractJpaDao<User> implements UserDAO {

	private final static Set<Class<?>> dataTypes = new HashSet<Class<?>>(
			Arrays.asList(new Class<?>[] { User.class }));

	@PersistenceContext(unitName = "")
	private EntityManager entityManager;

	public UserDaoImpl() {
		super();
	}

	@Override
	public EntityManager getEntityManager() {
		return entityManager;
	}

	@Override
	public Set<Class<?>> getTypes() {
		return dataTypes;
	}

	@Override
	public boolean canBeMerged(User o) {
		// TODO Auto-generated method stub
		return false;
	}

	public User getUserByUsername(String username) throws DataAccessException {
		try {
			return executeQueryByNameSingleResult("findUserByUsername",
					username);
		} catch (NoResultException nre) {
			return null;
		}
	}

	public User get(Long id) {
		// TODO Auto-generated method stub
		return null;
	}

	public List<User> getAll(Pager pager) {
		// TODO Auto-generated method stub
		return null;
	}

	public List<User> getAll() {
		// TODO Auto-generated method stub
		return null;
	}

	public PagedResultSet getPagedResults(Pager pager) {
		// TODO Auto-generated method stub
		return null;
	}

	public void save(User object) {
		// TODO Auto-generated method stub

	}

	public void delete(User object) {
		// TODO Auto-generated method stub

	}

	public Integer getAllCount() {
		// TODO Auto-generated method stub
		return null;
	}

	public Boolean isUnique(Long id, String fieldName, String fieldValue) {
		// TODO Auto-generated method stub
		return null;
	}

}
